// 构建计费查询参数
import CarChargingReq from '@/components/ivew_conf/car_charging_req'

export default (ctx, next) =>{

    let carFormStore = ctx.store['state']['carFormStore'];
    let dangerPropbability = carFormStore['dangerPropbability']
    let chargingCode:any = carFormStore['chargingCode'] 
    let params = new CarChargingReq();

    
    // 提取出险率
    Object.keys(params).forEach(key =>{
        params[key] = dangerPropbability[key];
    })
    
    // 配置订单号
    params.orderId = carFormStore['orderData']['Did'];

    // 计费验证二维码（部分保险公司需要该数据）
    if(!chargingCode){
        chargingCode = {
            jqCheckData: null,
            syCheckData: null
        }
    }

    Object.assign(params, chargingCode)
    ctx.params = params;
    
    next()
}